package com.woniuxy.ssm.mapper;

import com.woniuxy.ssm.bean.DeptBean;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author linke
 * @version 1.0
 * @className: DeptMapper
 * @description: 部门持久层接口
 * @date 2021/11/15 1:17
 */
public interface DeptMapper {
    /**
     * 查询所有的部门
     * @return
     */

    @Results({
            @Result(id = true,property = "id",column = "id",javaType = Long.class),
            @Result(property = "deptName",column = "dept_name",javaType = String.class)
    })
    @Select("select id,dept_name from dept_info where status = 0")
    List<DeptBean> findAll();


    @Results({
            @Result(id = true,property = "id",column = "id",javaType = Long.class),
            @Result(property = "deptName",column = "dept_name",javaType = String.class)
    })
    @Select("select id,dept_name from dept_info where status = 0 and id = #{id}")
    DeptBean getOneById(@Param("id") Long id);
}
